//
//  VKHisRecordCell.m
//  V-Learn
//
//  Created by liubo on 2019/1/11.
//  Copyright © 2019 yxk. All rights reserved.
//

#import "VKHisRecordCell.h"

@implementation VKHisRecordCell{
    UILabel *_contentLabel;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    VKHisRecordCell *cell = [tableView dequeueReusableCellWithIdentifier:@"VKHisRecordCell"];
    if (cell == nil) {
        cell = [[VKHisRecordCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"VKHisRecordCell"];
    }
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 点击cell的时候不要变色
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor cz_colorWithRed:244 green:244 blue:244];

        // 布局子控件
        [self autoLayout];
    }
    return self;
}

-(void)setModel:(VKHisRecordModel *)model{
    _model = model;
    _contentLabel.text = model.opinionContent;
}

- (void)autoLayout{
    
    UIView *bgView = [[UIView alloc]init];
    [self.contentView addSubview:bgView];
    bgView.backgroundColor = [UIColor whiteColor];
    bgView.layer.cornerRadius = 6;
    bgView.layer.masksToBounds = YES;
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(@15);
        make.right.mas_equalTo(-15);
        make.bottom.mas_equalTo(self.contentView.mas_bottom);
    }];
    
    UILabel *contentLabel = [[UILabel alloc]init];
    _contentLabel = contentLabel;
    [self.contentView addSubview:contentLabel];
//    contentLabel.text = @"历史记录历史记录历史记录历史记录历史记录历史记录历史记录";
    contentLabel.numberOfLines = 0;
    contentLabel.textColor = [UIColor cz_colorWithRed:62 green:62 blue:62];
    contentLabel.font = [UIFont systemFontOfSize:15];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(bgView).offset(15);
        make.right.mas_equalTo(bgView).offset(-15);
        make.bottom.mas_equalTo(bgView.mas_bottom).offset(-15);
    }];
}

@end
